<template>
	<view>
		<!-- 巡检故障首页 -->
		<view class="Inspection_io">

			<view class="header_flex">
				<view @tap="headerTap(1)" :class="{'header_text_click':headerTapNum==1}" class="header_text">日程
				</view>
				<view @tap="headerTap(2)" :class="{'header_text_click':headerTapNum==2}" class="header_text">隐患
				</view>
			</view>

			<view v-if="headerTapNum==1">

				<view class="Inspection_header">

					<view class="">
						<uni-calendar :start-date="currentDate()" :mark="false" :insert="true" :selected="selected"
							@change="change" />
					</view>
				</view>
				<scroll-view scroll-y="true" class="scroll-Y">
					<view class="Inspection_center">
						<view class="Inspection_flex" @tap="inspectionTap(item)" :key="index"
							v-for="(item,index) in inspectionData">
							<view class="">
								<view class="Inspection_title">
									{{item.title}}
								</view>
								<view class="Inspection_text">
									{{item.jihua}}| {{item.name}}
								</view>

							</view>
							<view class="" style="color: #007aff;font-size: 30rpx;">
								进入
							</view>

						</view>

					</view>
				</scroll-view>
			</view>
			<view v-if="headerTapNum==2">
				<scroll-view scroll-y="true" class="scroll-YTwo">
					<view class="Inspection_center">
						<view class="Inspection_flex" @tap="faultTap(item)" :key="index"
							v-for="(item,index) in faultData">
							<view class="">
								<view class="Inspection_title">
									{{item.title}}
								</view>
								<view class="Inspection_text2">
									{{item.jihua}}
								</view>
								<view class="Inspection_text">
									{{item.times}}
								</view>
							</view>
							<view class="" style="color: #007aff;font-size: 30rpx;">
								待处理
							</view>

						</view>

					</view>
				</scroll-view>

			</view>

		</view>
	</view>
</template>

<script>
	import config from '@/config'
	import {
		getMyTaskList
	} from '@/apis/modules/inspectionApp';

	export default {
		data() {
			return {
				baseUrl: config.baseUrl,
				selected: [],
				inspectionData: [{
					title: '息县污水站巡检',
					jihua: '每周二,周五',
					name: '装完'
				}, {
					title: '息县污水站巡检',
					jihua: '每周二,周五',
					name: '装完'
				}, {
					title: '息县污水站巡检',
					jihua: '每周二,周五',
					name: '装完'
				}, {
					title: '息县污水站巡检',
					jihua: '每周二,周五',
					name: '装完'
				}, {
					title: '息县污水站巡检',
					jihua: '每周二,周五',
					name: '装完'
				}, {
					title: '息县污水站巡检',
					jihua: '每周二,周五',
					name: '装完'
				}, {
					title: '息县污水站巡检',
					jihua: '每周二,周五',
					name: '装完'
				}, {
					title: '息县污水站巡检',
					jihua: '每周二,周五',
					name: '装完'
				}, {
					title: '息县污水站巡检',
					jihua: '每周二,周五',
					name: '装完'
				}],
				headerTapNum: 1,
				faultData: [{
					title: '息县污水站巡检',
					jihua: '的上空经过考试的结果开始',
					times: '2014-09-08'
				}, {
					title: '息县污水站巡检',
					jihua: '的上空经过考试的结果开始',
					times: '2014-09-08'
				}, {
					title: '息县污水站巡检',
					jihua: '的上空经过考试的结果开始',
					times: '2014-09-08'
				}, {
					title: '息县污水站巡检',
					jihua: '的上空经过考试的结果开始',
					times: '2014-09-08'
				}, {
					title: '息县污水站巡检',
					jihua: '的上空经过考试的结果开始',
					times: '2014-09-08'
				}, {
					title: '息县污水站巡检',
					jihua: '的上空经过考试的结果开始',
					times: '2014-09-08'
				}, {
					title: '息县污水站巡检',
					jihua: '的上空经过考试的结果开始',
					times: '2014-09-08'
				}, {
					title: '息县污水站巡检',
					jihua: '的上空经过考试的结果开始',
					times: '2014-09-08'
				}, {
					title: '息县污水站巡检',
					jihua: '的上空经过考试的结果开始',
					times: '2014-09-08'
				}, {
					title: '息县污水站巡检',
					jihua: '的上空经过考试的结果开始',
					times: '2014-09-08'
				}, {
					title: '息县污水站巡检',
					jihua: '的上空经过考试的结果开始',
					times: '2014-09-08'
				}, {
					title: '息县污水站巡检',
					jihua: '的上空经过考试的结果开始',
					times: '2014-09-08'
				}, ],
			}
		},
		onLoad(options) {

		},
		methods: {
			currentDate() {
				return new Date().toLocaleDateString();
			},
			//改日期
			change(e) {
				console.log(111111111111111,3,e)
				this.inspectionList(e.fulldate)
			},
			//巡检列表
			inspectionList(e) {
				let parms = {
					inspectionUserId: this.profile.userId,
					inspectionDate: e
				}
				getMyTaskList(parms).then((res) => {
					console.log(res)
				})

			},
			//巡检故障
			faultList(e) {
				console.log(e, '111')
			},
			//巡检故障切换
			headerTap(type) {
				this.headerTapNum = type
			},
			//巡检列表点击进入巡检页
			inspectionTap(item) {
				console.log(item)
			},
			//故障列表点击进入巡检页
			faultTap(item) {
				console.log(item)
			}
		}
	}
</script>

<style scoped lang="scss">
	.Inspection_io {
		width: 100%;

		.scroll-Y {
			height: calc(50vh);
		}

		.scroll-YTwo {
			height: calc(84vh);
		}

		.header_flex {
			display: flex;

			.header_text {
				width: 50%;
				text-align: center;
				padding: 10rpx 30rpx;
			}

			.header_text_click {
				padding: 10rpx 30rpx;
				background-color: #007aff;
				color: white;
				margin: 10rpx;
				border-radius: 10rpx;
			}
		}



		.Inspection_header {
			background-color: white;
			border-radius: 10rpx;
			overflow: hidden;


		}

		.Inspection_flex {
			background-color: white;
			padding: 20rpx 30rpx 0 30rpx;
			margin-top: 10rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			border-radius: 10rpx;
			border-top: 1px solid gainsboro;

			.Inspection_title {
				font-size: 32rpx;
				font-weight: bold;
			}

			.Inspection_text2 {
				font-size: 28rpx;
				color: gray;
				padding: 5rpx 0rpx;
			}

			.Inspection_text {
				font-size: 28rpx;
				color: gray;
				padding: 10rpx 0rpx;
			}
		}
	}
</style>